/*
 * CreditPanel.java
 *
 * Created on 2008年5月27日, 下午9:39
 */

package gui;

/**
 *
 * @author  yux
 */
public class OptionCreditPanel extends javax.swing.JPanel {
    model.CreditCardAccount account;
    private MainFrame mf;
    /** Creates new form CreditPanel */
    public OptionCreditPanel(MainFrame m, abstractmodel.IAccount a) {
        mf = m;
        account = (model.CreditCardAccount)a;
        initComponents();
        initInfo();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextFieldName = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextFieldBank = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextFieldBankName = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextFieldValid = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jTextFieldNumber = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextFieldBound = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTextFieldPay = new javax.swing.JTextField();
        jTextFieldSlipDay = new javax.swing.JTextField();

        jLabel1.setFont(new java.awt.Font("宋体", 0, 18));
        jLabel1.setText("信用卡帐户信息");

        jLabel2.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel2.setText("名称");

        jLabel3.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel3.setText("开户银行");

        jLabel4.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel4.setText("开户名");

        jLabel5.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel5.setText("有效日期");

        jLabel6.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel6.setText("账单日");

        jLabel7.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel7.setText("卡号");

        jLabel8.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel8.setText("信用额度");

        jLabel9.setFont(new java.awt.Font("宋体", 0, 14));
        jLabel9.setText("还款日期");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(41, 41, 41)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel6))
                                .addGap(28, 28, 28))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addGap(18, 18, 18)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextFieldSlipDay)
                            .addComponent(jTextFieldValid)
                            .addComponent(jTextFieldBank)
                            .addComponent(jTextFieldBankName, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
                            .addComponent(jTextFieldName))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(9, 9, 9))
                            .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jTextFieldBound, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jTextFieldPay, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE)))))
                .addGap(52, 52, 52))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addComponent(jLabel1)
                .addGap(37, 37, 37)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jTextFieldName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel7)
                    .addComponent(jTextFieldBank, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jLabel4)
                    .addComponent(jTextFieldBankName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldBound, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(jLabel5))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel9)
                            .addComponent(jTextFieldPay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldValid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jTextFieldSlipDay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(121, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void initInfo() {
        jTextFieldBank.setText(account.getAccountInfo().getValue("归属银行").toString());
        jTextFieldBankName.setText(account.getAccountInfo().getValue("开户名").toString());
        jTextFieldBound.setText(account.getAccountInfo().getValue("额度").toString());
        jTextFieldName.setText(account.getAccountInfo().getValue("帐户名称").toString());
        jTextFieldNumber.setText(account.getAccountInfo().getValue("卡号").toString());
        jTextFieldPay.setText(account.getAccountInfo().getValue("还款日期").toString());
        jTextFieldSlipDay.setText(account.getAccountInfo().getValue("帐单日").toString());
        jTextFieldValid.setText(account.getAccountInfo().getValue("有效日期").toString());
    }
        
    public String[] returnValue() {
        String[] s;
        s = new String[8];
        //"帐户名称", "归属银行", "卡号", "开户名", "额度", "有效日期", "还款日期", "帐单日"
        s[0] = jTextFieldName.getText();
        s[1] = jTextFieldBank.getText();
        s[2] = jTextFieldNumber.getText();
        s[3] = jTextFieldBankName.getText();
        s[4] = jTextFieldBound.getText();
        s[5] = jTextFieldValid.getText();
        s[6] = jTextFieldPay.getText();
        s[7] = jTextFieldSlipDay.getText();
        return s;
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jTextFieldBank;
    private javax.swing.JTextField jTextFieldBankName;
    private javax.swing.JTextField jTextFieldBound;
    private javax.swing.JTextField jTextFieldName;
    private javax.swing.JTextField jTextFieldNumber;
    private javax.swing.JTextField jTextFieldPay;
    private javax.swing.JTextField jTextFieldSlipDay;
    private javax.swing.JTextField jTextFieldValid;
    // End of variables declaration//GEN-END:variables
    
}
